<!DOCTYPE html>
<html lang="zh-cn">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>3D立方体动画</title>
	<style>
		* {
			padding: 0;
			margin: 0;
		}
		body {
			position: relative;
			left: 0;
			right: 0;
			width: 100vw;
			height: 100vh;
			background: linear-gradient(90deg, #FFCF71, #2376DD );
		}
		div{
			position: absolute;
			margin: 200px 600px;
			perspective: 2000px;
			
		}
		.one {
			position: absolute;
			list-style: none;
			width: 300px;
			height: 300px;
			margin: 0 auto;
			transform-style: preserve-3d;
			animation: move 7s linear infinite ;
		}
		.one li{
			position: absolute;
			top: 0;
			left: 0;
			width: 300px;
			height: 300px;
			line-height: 300px;
			text-align: center;
			font-size: 40px;
			border: 1px solid #fff;
			transition: all 0.3s linear;
			background-color: #ccc;
			opacity:.7;/* 透明度 */
		}
		.two {
			position: absolute;
			list-style: none;
			/* left: 150px;
			top: 150px; */
			width: 200px;
			height: 200px;
			margin: 0 auto;
			transform-style: preserve-3d;
			animation: move2 7s linear infinite ;
		}
		.two li{
			position: absolute;
			top: 0px;
			left: 0px;
			width: 200px;
			height: 200px;
			margin: 50px;
			line-height: 200px;
			text-align: center;
			font-size: 10px;
			background-color: #ccc;
			opacity:.7;/* 透明度 */
		}
		.one > li:nth-of-type(1) {
			transform: translateZ(150px);
		}
		.one > li:nth-of-type(2) {
			transform: translateZ(-150px) rotateY(180deg);
		}
		.one > li:nth-of-type(3) {
			transform: translateX(-150px) rotateY(-90deg);
		}
		.one > li:nth-of-type(4) {
			transform: translateX(150px) rotateY(90deg);
		}
		.one > li:nth-of-type(5) {
			transform: translateY(-150px) rotateX(90deg);
		}
		.one > li:nth-of-type(6) {
			transform: translateY(150px) rotateX(-90deg);
		}
		/* 里面的小盒子 */
		.two > li:nth-of-type(1) {
			transform: translateZ(100px);
		}
		.two > li:nth-of-type(2) {
			transform: translateZ(-100px) rotateY(180deg);
		}
		.two > li:nth-of-type(3) {
			transform: translateX(-100px) rotateY(-90deg);
		}
		.two > li:nth-of-type(4) {
			transform: translateX(100px) rotateY(90deg);
		}
		.two > li:nth-of-type(5) {
			transform: translateY(-100px) rotateX(90deg);
		}
		.two > li:nth-of-type(6) {
			transform: translateY(100px) rotateX(-90deg);
		}
		
		
		div:hover .one > li:nth-of-type(1) {
			transform: translateZ(300px);
		}
		div:hover .one > li:nth-of-type(2) {
			transform: translateZ(-300px) rotateY(180deg);
		}
		div:hover .one > li:nth-of-type(3) {
			transform: translateX(-300px) rotateY(-90deg);
		}
		div:hover .one > li:nth-of-type(4) {
			transform: translateX(300px) rotateY(90deg);
		}
		div:hover .one > li:nth-of-type(5) {
			transform: translateY(-300px) rotateX(90deg);
		}
		div:hover .one > li:nth-of-type(6) {
			transform: translateY(300px) rotateX(-90deg);
		}
		@keyframes move{
			0%{
				
			}
			100%{
				transform: rotate3d(0,1,1,360deg); 
			}
		}
	</style>
</head>
<body>
	<div>
		<ul class="one">
			<li>01-前面</li>
			<li>02-后面</li>
			<li>03-左面</li>
			<li>04-右面</li>
			<li>05-上面</li>
			<li>06-下面</li>
			<ul class="two">
				<li>07-里前</li>
				<li>08-里后</li>
				<li>09-里左</li>
				<li>10-里右</li>
				<li>11-里上</li>
				<li>12-里下</li>
			</ul>
		</ul>
	</div>
</body>
</html>